package com.caochenlei.graph;

public class EdgeWeightedDirectedCycleTest {
    public static void main(String[] args) {
        EdgeWeightedDigraph EWD = new EdgeWeightedDigraph(5);
        EWD.addEdge(new DirectedEdge(3, 0, 0.28));
        EWD.addEdge(new DirectedEdge(0, 2, 0.32));
        EWD.addEdge(new DirectedEdge(2, 1, 0.31));
        EWD.addEdge(new DirectedEdge(1, 0, 0.35));
        EWD.addEdge(new DirectedEdge(1, 4, 0.26));
        EdgeWeightedDirectedCycle cycle = new EdgeWeightedDirectedCycle(EWD);
        System.out.println("是否有环：" + cycle.hasCycle());
        System.out.println("====================");
        for (DirectedEdge edge : EWD.edges()) {
            System.out.println(edge);
        }
    }
}
